//输出日志
function outputLog(msg){
	$("#console").append(msg+"<br/>") ;
}
//遍历对象属性
function showObj(o){
	var res = "" ;
	for(tmp in o){
		res += tmp+":"+o[tmp]+";" ;
	}
	
	return res ;
}

/**
 * 操作类的基类，用于声明必须实现哪些接口
 */
function operator(manager){
	this.init(manager) ;
}
operator.prototype.init = function(manager){
	this.manager = manager ;
}
operator.prototype.mouseDown = function (){
	alert('mouseDown') ;
}
operator.prototype.mouseUp = function (){
	alert('mouseUp') ;	
}
operator.prototype.mouseMove = function (){
	//alert('mouseMove') ;	
}
operator.prototype.updatePos = function (){
	var obj = this.manager.tmpObj ;
	obj.x = this.manager.startPos.x ;
	obj.y = this.manager.startPos.y ;
	
	obj.ex = this.manager.indexPos.x ;
	obj.ey = this.manager.indexPos.y ;
}
/**
 * 图形模式操作基础类
 */
graphOper.prototype = new operator() ;
function graphOper(manager){
	this.init(manager) ;
	this.manager=manager ;
}
graphOper.prototype.mouseDown = function(){
}
graphOper.prototype.mouseMove = function(){
	this.updatePos() ;
	this.manager.paint() ;
}

graphOper.prototype.mouseUp = function(){
	try{
		this.updatePos() ;				
		this.manager.addNode(this.manager.tmpObj) ;
		this.manager.tmpObj = null ;
		this.manager.paint() ;
	}catch(e){alert(e.message)}
}
/**
 * 图形类基类
 */
function graph(){
	this.x = 0 ; 
	this.y = 0 ;
	this.ex = 0 ;
	this.ey = 0 ;
}
graph.prototype.paint=function(printer){} ;

